package com.yuanlrc.base.service.admin;

import com.yuanlrc.base.dao.admin.BookCategoryDao;
import com.yuanlrc.base.entity.admin.BookCategory;
import com.yuanlrc.base.entity.admin.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookCategoryService  {
@Autowired
    private BookCategoryDao  bookCategoryDao  ;

    /**
     * 书籍类别添加/编辑
     * @param bookCategory
     * @return
     */
    public BookCategory save(BookCategory bookCategory){
        return bookCategoryDao.save(bookCategory);
    }

    /**
     * 获取所有的书籍类别列表
     * @return
     */
    public List<BookCategory> findAll(){
        return bookCategoryDao.findAll();
    }

    /**
     * 根据id查询类别
     * @param id
     * @return
     */
    public BookCategory find(Long id){
        return bookCategoryDao.find(id);
    }

    /**
     * 根据id删除一条记录
     * @param id
     */
    public void delete(Long id){
        bookCategoryDao.deleteById(id);
    }

}
